home *** CD-ROM | disk | FTP | other *** search
- (* Dendrite simulates diffusion limited aggregation. The rule
- is from Toffoli and Margolus page 167. State 1 are particles
- that move randomly until they enter a block containing
- the dendritic growth (state 2). The particle is then added
- to the growth.
-
- To see how this works select all the cells and randomize
- the low bit. Try starting with a density of 10%. Then
- place a seed with state 2 in the center. The particles
- will move about and gradually accumulate onto the seed. *)
- RULE Dendrite (cell, opp, cw, ccw)
- VAR new, growth
- BEGIN
- growth := cell[1] OR opp[1] OR cw[1] OR ccw[1]
- IF growth THEN (* does block contain growth? *)
- new := 2*(cell[1] OR cell[0]) (* yes, particle sticks *)
- ELSE
- IF rand THEN (* no, particles do random walk *)
- new := cw[0]
- ELSE
- new := ccw[0]
- END
- END
- RETURN new
- END